<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>{$title}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    {css href="__STATIC__/admin/css/font.css" /}
    {css href="__STATIC__/admin/css/xadmin.css" /}

    {js href="__STATIC__/admin/js/jquery.min.js" /}
    {js href="__STATIC__/admin/lib/layui/layui.js" /}
    {js href="__STATIC__/admin/js/global.js" /}
    {js href="__STATIC__/admin/js/xadmin.js" /}
    {js href="__STATIC__/common/js/common.js" /}
    {js href="__STATIC__/admin/js/xcity.js" /}
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:void(0);">{$navigate[0]}</a>
        <a>
          <cite>{$navigate[1]}</cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.split('?')[0]);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>
</div>
{block name="x-body"}{/block}

<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*用户-停用*/
    function member_stop(obj,id,url){
        var title = $(obj).attr('title');
        var status = $(obj).data('status');

        layer.confirm('确认要'+ title +'吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            $.post(url, {'status': status, '__token__': token, 'id': id}, function(res){
                if(res.code == 1){
                    var title = '停用',icon = '&#xe601;',text = '已启用',expr = 6;
                    if(res.data.status == 0){
                        title = '启用';
                        icon = '&#xe62f;';
                        text = '已停用';
                        expr = 5;

                        $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '1');
                    }else{
                        $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '0');
                    }
                }else{
                    text = res.msg;
                }

                $(obj).attr('title',title)
                $(obj).find('i').html(icon);

                layer.msg(text,{icon: expr,time:1000});

                var token = $("input[name='__token__']",top.window.document).val(res.data.token);
            }, 'json');
        });
    }

    /*用户-删除*/
    function member_del(obj,id, url, fn = false){
        layer.confirm('确认要删除吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            //发异步删除数据
            $.post(url, {'id': id, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(obj).parents("tr").remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000}, function(){
                    if(fn)fn();
                });

            },'json');
        });
    }

    function delAll (url) {
        var data = tableCheck.getData();
        var token = $("input[name='__token__']",top.window.document).val();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            $.post(url, {'id': data, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(".layui-form-checked").not('.header').parents('tr').remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000});
            },'json');
        });
    }

    // 跳转地址
    function load_url(url){
        window.location.href = url;
    }

</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>